package com.core.zyyz.amc.modules.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.core.common.annotation.Log;
import com.core.common.core.controller.BaseController;
import com.core.common.core.domain.AjaxResult;
import com.core.common.enums.BusinessType;
import com.core.zyyz.amc.modules.domain.AmcPubTabD;
import com.core.zyyz.amc.modules.service.AmcPubTabDService;
import com.core.common.utils.poi.ExcelUtil;
import com.core.common.core.page.TableDataInfo;

/**
 * 公共页签Controller
 *
 * @author LiuFushun
 * @date 2024-11-19
 */
@RestController
@RequestMapping("/amc/tab")
public class AmcPubTabDController extends BaseController
{
    @Autowired
    private AmcPubTabDService amcPubTabDService;

    /**
     * 查询公共页签列表
     */
    @PreAuthorize("@ss.hasPermi('amc:tab:list')")
    @GetMapping("/list")
    public TableDataInfo list(AmcPubTabD amcPubTabD) {
        startPage();
        List<AmcPubTabD> list = amcPubTabDService.selectAmcPubTabDList(amcPubTabD);
        return getDataTable(list);
    }

    /**
     * 获取公共页签详细信息
     */
    @PreAuthorize("@ss.hasPermi('amc:tab:query')")
    @GetMapping(value = "/{tabId}")
    public AjaxResult getInfo(@PathVariable("tabId") String tabId) {
        return success(amcPubTabDService.selectAmcPubTabDByTabId(tabId));
    }

    /**
     * 新增公共页签
     */
    @PreAuthorize("@ss.hasPermi('amc:tab:add')")
    @Log(title = "公共页签", businessType = BusinessType.INSERT)
    @PostMapping("/insertPubTab")
    public AjaxResult add(@RequestBody AmcPubTabD amcPubTabD)
    {
        return toAjax(amcPubTabDService.insertAmcPubTabD(amcPubTabD));
    }

    /**
     * 修改公共页签
     */
    @PreAuthorize("@ss.hasPermi('amc:tab:edit')")
    @Log(title = "公共页签", businessType = BusinessType.UPDATE)
    @PostMapping("/updatePubTab")
    public AjaxResult edit(@RequestBody AmcPubTabD amcPubTabD)
    {
        return toAjax(amcPubTabDService.updateAmcPubTabD(amcPubTabD));
    }

    /**
     * 删除公共页签
     */
    @PreAuthorize("@ss.hasPermi('amc:tab:remove')")
    @Log(title = "公共页签", businessType = BusinessType.DELETE)
    @DeleteMapping("/{tabIds}")
    public AjaxResult remove(@PathVariable String[] tabIds)
    {
        return toAjax(amcPubTabDService.deleteAmcPubTabDByTabIds(tabIds));
    }
}
